import {useEffect, useState} from "react";
import {Button } from "antd"
function ceshi(props) {
    console.log("组件重新执行一次")
    useEffect(()=>{
        console.log("初始化执行一次")
    },[])
    const [shuju,setshuju] = useState(
        {
            a:"17",
            b:"18",
            c:"19",
        }
    )
    let aaaa = ""
    let bbbb = []
    const dianji1=()=>{
        aaaa = "72"
        // setshuju({...shuju,c:"b"})
        setshuju((old)=>{return {...old,c:"asdasda"}})
        console.log(aaaa,shuju,bbbb)
    }
    const dianji2=()=>{
        aaaa = aaaa + "p"
        bbbb = [...bbbb,"111"]
        setshuju((old)=>{return {...old,c:"asdasda"}})
        console.log(aaaa,shuju,bbbb)
    }
    return <div>
        <div>{shuju.a}</div>
        <div>{shuju.b}</div>
        <div>{shuju.c}</div>
        <Button type="primary" onClick={dianji1}>按钮1</Button>
        <Button type="primary" onClick={dianji2}>按钮2</Button>
    </div>
}
export default ceshi